<?php
namespace app\admin\controller;

class Sharestat extends Admin{
    public function __construct(){
        parent::__construct();
        $this->model = "ShareStat";
        $this->assign("model",$this->model);
    }
    public function index_stat(){
        
        return $this->fetch();
    }
    protected function get_where_map(){
        $keywords = input('param.keywords');
        $kind = input('param.kind');
 
        $whereData['typeid'] = 3;
        if ($kind) {
            $whereData['kind'] = $kind;
        }else{
            $whereData['kind'] = ['in', [4,5]];
        }
        $where = [];
        if ($keywords) {
            $where['realname'] = ['like', "%$keywords%"];
        }
        $userids = [];
        if ($this->uinfo['roleid'] != 1) {
            $userids = model('AdminUser')->get_all_userids($this->uinfo['userid'], $this->uinfo['roleid'], $where);
        }else{
            $list = model('AdminUser')->where($where)->field('userid')->order("userid asc")->select();
            foreach ($list as $v) {
                $userids[] = $v['userid'];
            }
        }
        $whereData['userid'] = ['in', $userids];
        return $whereData;
    }
}